package com.su.song.myapplicationc4;

import android.content.Intent;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.view.View;
import android.widget.Button;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity2 extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        Button button3 = findViewById(R.id.button3);
        button3.setOnClickListener(new View.OnClickListener() {
//            通过匿名内部类处理点击，还可以变成箭头函数的形式，点击就行
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();//意图对象
                intent.setClass(MainActivity2.this,MainActivity3.class);
                startActivity(intent);
            }
        });
    }
}

